import React, { Component } from 'react'
import Child from './Child'

// 子组件向父组件传递数据
// 1. 在组件上自定义属性(值只能是函数)

export default class Father extends Component {
    state = {
        count: ""
    }
    acceptCount = (count) => {
        this.setState({
            count
        })
    }
    render() {
        const { count } = this.state
        return (
            <div>
                <h2>我是父组件---{ count }</h2>
                <Child acceptCount = { this.acceptCount }/>
            </div>
        )
    }
}
